<template>
	<view>
		<view class="header">
			<view class=" u-flex u-p-20">
				<u-input @click="calendarState = true" v-model="date.startDate" input-align="center" border disabled
					placeholder="开始日期"></u-input>
				<u-input @click="calendarState = true" class="u-m-l-10" v-model="date.endDate" input-align="center" border
					disabled placeholder="结束日期">
				</u-input>
				<u-calendar v-model="calendarState" mode="range" @change="handleChange"></u-calendar>
			</view>
			<u-gap height="20" bg-color="#aaaaff"></u-gap>
		</view>
		<!-- <view class="content">
			<scroll-view scroll-y="true" :style="{height:contentHeight + 'px'}">
				<u-collapse :head-style="{backgroundColor:'#f5f5f5',paddingLeft:'20rpx'}" :body-style="{color:'#000'}">
					<d-collapse-item class="border-y" style="margin-top:-1px;" :title="item.name"
						v-for="(item, index) in todayList" :key="index">
						<template v-slot:title>
							<view class="u-flex" style="width:100%;">
								<view class="u-flex-1">{{ item.name }}</view>
								<view class="u-p-r-20">总计：{{ getBossTotal(item.tobills) }}元</view>
							</view>
						</template>
		
						<view v-if="item.tobills.length > 0"
							class="u-flex u-row-around u-border-top-bottom u-p-t-20 u-p-b-20">
							<view>商品</view>
							<view>单价</view>
							<view>数量</view>
						</view>
						<view class="u-p-20 u-text-center" v-if="item.tobills.length < 1">暂无数据</view>
						<d-swipe-action  v-for="(row,i) in item.tobills" :key="i" :index="i" :show="row.show" btn-width="120" @click="(index,index1)=>handleSelectRow(item.tobills,index,index1)"
							@open="open(item.tobills,i)" :options="options">
							<view class="u-flex u-row-around u-border-top-bottom u-p-t-20 u-p-b-20">
								<view>{{ row.product }}</view>
								<view>{{ row.price }}</view>
								<view>{{ row.count }}</view>
							</view>
						</d-swipe-action>
					</d-collapse-item>
				</u-collapse>
			</scroll-view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				date: {
					startDate: '',
					endDate: ''
				},
				calendarState: false,
				oneOrTwoSign: '',
				contentHeight:0
				
			}
		},
		methods: {
			// 选择日期
			async handleChange(e) {
				this.date.startDate = e.startDate
				this.date.endDate = e.endDate
				const res = await this.$u.post('/historybills',{
					startDate:e.startDate,
					endDate:e.endDate
				})
				console.log('res',res)
			},
			// 获取scroll-view滚动高度
			getContentHeight() {
				uni.getSystemInfo({
				    success:res =>{
				        let bodyHeight = res.windowHeight
						this.$u.getRect('.header').then(res => {
							this.contentHeight = bodyHeight - res.height
						})
				    }
				})
			}
		}
	}
</script>

<style>

</style>
